package com.android.xunxian;

import android.app.Application;
import android.os.Environment;

import com.baidu.mapapi.SDKInitializer;

import org.xutils.DbManager;
import org.xutils.x;

import java.io.File;

/**
 * Created by zouqh on 2016/7/13.
 */
public class MyApplication extends Application {

    public static  DbManager dbManager;

    @Override
    public void onCreate() {
        super.onCreate();
        SDKInitializer.initialize(this);
        x.Ext.init(this);
        dbManager=initDaoConfig();

    }

    public  DbManager initDaoConfig() {
//        DbManager.DaoConfig daoConfig = new DbManager.DaoConfig()
//                .setDbName("xunxian")
//                .setAllowTransaction(true)
//                .setDbDir(new
//                        File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/CB/"))
//                .setDbVersion(1)
//                .setDbUpgradeListener(new DbManager.DbUpgradeListener() {
//                    @Override
//                    public void onUpgrade(DbManager db, int oldVersion, int newVersion) {
//                        // TODO: ...
//                        // db.addColumn(...);
//                        // db.dropTable(...);
//                        // ...
//                    }
//                });
         DbManager.DaoConfig daoConfig= new DbManager.DaoConfig();
        DbManager db = x.getDb(daoConfig);
        return db;
    }
}
